<template>
  <div class="wdsc">
    <div class="spkp" v-for="(item, index) in obj.list" @click="txq(item)">
      <span class="q1">{{ item.course_classify_title }}</span>
      <p class="q2">{{ item.title }}</p>
      <span class="q3">{{ item.start_time }} </span>
      <ul>
        <li class="q4" v-for="(item1, index1) in item.teacher">
          <img class="qi" :src="item1.avatar" alt="" /><span>{{
            item1.teacher_name
          }}</span>
        </li>
      </ul>
      <div class="q5">
        <span>{{ item.sales_num }}人已报名</span>
        <span style="font-size: 18px" :class="item.price == 0 ? 'ls' : 'hs'">
          {{ filte(item.price) }}
        </span>
      </div>
    </div>
  </div>
</template>

<script setup>
import { reactive, ref, toRefs } from "vue";
import { getsc } from "../http/api.js";
import { useRoute, useRouter } from "vue-router";
const obj = reactive({
  list: [],
});
const txq = (i) => {
  console.log(i);
  router.push({ path: "/xq", query: { id: i.id } });
};
const router = useRouter();
const sc = async () => {
  const res = await getsc(localStorage.getItem("userid"));
  obj.list = res.data.data.list;
  console.log(obj.list);
};
function filte(i) {
  if (i == 0) {
    return "免费";
  } else {
    return i / 100;
  }
}
sc();
</script>
<style lang="scss" scoped>
.scroll {
  overflow: auto !important;
  height: calc(100% - 620px);
}
.q5 {
  padding: 15px 0;
  display: flex;
  justify-content: space-between;
}
.ls {
  color: green;
}
.hs {
  color: red;
}
.qi {
  width: 70px;
  height: 70px;
  border-radius: 50%;
}
ul {
  padding: 15px 0;
  display: flex;
  li {
    display: flex;
    align-items: center;
    margin-right: 10px;
    img {
      margin-right: 5px;
    }
  }
}
.q3 {
  margin-left: 15px;
  display: inline-block;
  padding: 8px 8px;
  background: #f5f6f8;
  border-radius: 15px;
}
.q2 {
  padding: 15px 0 5px 0;
  font-size: 26px;
}
.q1 {
  background: #f15a24;
  padding: 5px 15px;
  color: #fff;
}
.spkp {
  padding: 15px;
}
.kk {
  border-bottom: 3px #f15a24 solid;
  display: inline-block;
  box-sizing: border-box;
  padding: 15px;
}
.zj {
  padding: 15px;
}
* {
  list-style: none;
}
.js {
  width: 90%;
  margin: 0 auto;
  transform: translateY(-50%);
  background: #fff;
  padding: 15px;
  border-radius: 10px;
}
.ll {
  height: 100px;
  text-align: center;
  margin-top: 30px;
  display: flex;
  flex-direction: column;
  align-items: center;
  color: #fff;
  span {
    margin-top: 15px;
  }
}
.ii {
  width: 80px;
  height: 80px;
  border-radius: 50%;
}
.center {
  height: 400px;
  background-color: #51bdfd;
  border-top: 1px solid #51bdfd;
  position: relative;
  margin-top: 45px;
}
.msxq {
  width: 100%;
  height: 100vh;
  overflow: auto;
  //   height: 100% !important;
}
.title {
  display: flex;
  justify-content: space-between;
  position: fixed;
  left: 0;
  right: 0;
  box-sizing: border-box;
  top: 0;
  background: #fff;
  width: 100%;
  padding: 15px;
  z-index: 1000;
  span {
    font-size: 35px;
  }
}
* {
  margin: 0;
  padding: 0;
}
</style>
